const a = async function (...args) {
  const [
    { file },
    _,
    { memory, me },
    {
      dc: { update, upload },
      xe: { get, set },
    },
  ] = args;
  if (!args[0]["filename"]) args[0]["filename"] = file.name;
  const ret = await upload(...args);
  const FILEPATH = ret?.data?.url;
  const FILENAME = file.name;
  const FILESIZE = file.size;
  console.log("upload: ", args, update, FILENAME, FILEPATH, FILESIZE);
  const files = get(memory, "files", []);
  files.push({ FILENAME, FILEPATH, FILESIZE });
  update({
    path: me,
    action: "load",
    value: {
      fileName: FILENAME,
    },
  });
  set(memory, "files", files);
  return ret;
};

const b = async (...args) => {
  const { file } = args[0];
  if (!args[0]["filename"]) args[0]["filename"] = file.name;
  const ret = await upload(...args);
  const FILEPATH = ret?.data?.url;
  const FILENAME = file.name;
  const FILESIZE = file.size;
  console.log("upload: ", args, params, update, FILENAME, FILEPATH, FILESIZE);
  const { get, set } = xe;
  const files = get(memory, `${me}.files`, []);
  files.push({ FILENAME, FILEPATH, FILESIZE });
  set(memory, `${me}.files`, files);
  return ret;
};
